/*******************************************************************************
 * Copyright (c) 2002 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 ******************************************************************************/
package net.sourceforge.perforce.ui.prefs;

import net.sourceforge.perforce.ui.IPerforceUIConstants;
import net.sourceforge.perforce.ui.PerforceUIPlugin;
import net.sourceforge.perforce.ui.internal.Policy;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

/**
  * @version $Revision: 154 $
  * @author  <a href="mailto:bpruessmann@users.sourceforge.net">Boris Pruessmann</a>
  */
public class P4MonitorPreferencesPage 
	extends FieldEditorPreferencePage 
	implements IWorkbenchPreferencePage 
{
	// ------------------------------------------------------------------------- Public Constructors
	
	/** Constructor for P4MonitorPreferencesPage. */
	public P4MonitorPreferencesPage()
	{
		super(FieldEditorPreferencePage.GRID);
		setPreferenceStore(PerforceUIPlugin.getPlugin().getPreferenceStore());
	}
	
	// ------------------------------------------------------------------------------ Public Methods
	
	/** @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */
	public void init(IWorkbench workbench) 
	{
	}

	// --------------------------------------------------------------------------- Protected Methods
	
	/** @see FieldEditorPreferencePage#createFieldEditors() */
	protected void createFieldEditors() 
	{
		IntegerFieldEditor updateInterval =
			new IntegerFieldEditor(
				IPerforceUIConstants.PREF_BACKGROUND_UPDATE_INTERVAL,
				Policy.bind("P4MonitorPreferencesPage.backgroundUpdateInterval"),      //$NON-NLS-1$
				getFieldEditorParent());
		addField(updateInterval);
		
		BooleanFieldEditor shouldMonitorChangelists =
			new BooleanFieldEditor(
				IPerforceUIConstants.PREF_SHOULD_MONITOR_CHANGELISTS,
				Policy.bind("P4MonitorPreferencesPage.shouldMonitorChangelists"),      //$NON-NLS-1$
				getFieldEditorParent());
		addField(shouldMonitorChangelists);

		BooleanFieldEditor shouldMonitorOpenedFiles =
			new BooleanFieldEditor(
				IPerforceUIConstants.PREF_SHOULD_MONITOR_OPENED_FILES,
				Policy.bind("P4MonitorPreferencesPage.shouldMonitorOpenedFiles"),      //$NON-NLS-1$
				getFieldEditorParent());
		addField(shouldMonitorOpenedFiles);			
	}
}
